﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Fetion
{
    public class Encrypt
    {
        private const Char XOR = 'T';
        public string encode(string sourceString)
        {
            Char[] sourceArray = sourceString.ToCharArray();
            System.Text.StringBuilder temp = new System.Text.StringBuilder(); 
            for (Int32 i = 0; i <sourceArray.Length; i++)
            {
                sourceArray[i] = (Char)(sourceArray[i] ^ XOR);
                temp.Append(sourceArray[i].ToString());
            }
            return temp.ToString();
        }

        public string decode(string ciphertext)
        {
            Char[] ciphertextArray = ciphertext.ToCharArray();
            System.Text.StringBuilder temp = new System.Text.StringBuilder();
            for (Int32 i = 0; i < ciphertextArray.Length; i++)
            {
                ciphertextArray[i] = (Char)(ciphertextArray[i] ^ XOR);
                temp.Append(ciphertextArray[i].ToString());
            }
            return temp.ToString();
        }
    }
}
